import Vue from 'vue';
import 'babel-polyfill';
import Cookies from 'js-cookie';
import 'normalize.css/normalize.css'; // a modern alternative to CSS resets
import 'bi-element-ui/lib/bi-element-ui.css';
import '@/style/ui.scss';
import Element from 'bi-eleme';
import '@/style/index.scss'; // global css
import BiElementUi from 'bi-element-ui';
// import hls from 'videojs-contrib-hls'; // 播放hls流需要的插件
import moment from 'moment';
import App from './App';
import store from './store';
import router from './router';
// import './icons'; // icon
// SVG配置
import 'virtual:svg-icons-register';
import SvgIcon from './components/SvgIcon/index.vue';

import './permission'; // permission control
import './utils/error-log'; // error log
import uploading from '@/utils/cos-upload';
import { formatNumber } from '@/utils/index';
import permission from '@/directive/permission/index.js'; // 权限判断指令
import loadmore from '@/directive/loadmore/index.js'; // 权限判断指令
import * as filters from './filters'; // global filters
import 'video.js/dist/video-js.css'; // 引入video.js的css
import selectPlaylet from '@/common/component/form/searchSelectMore.vue';
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
import './components/global';
import BiDrawer from '@/components/BiDrawer';
// 全局注册compontent
Vue.component('SelectPlaylet', selectPlaylet);
Vue.prototype.$moment = moment; // 挂载到vue原型链上
Vue.prototype.$formatNumber = formatNumber;
moment.locale('zh-cn');
// if (process.env.NODE_ENV === 'production') {
// const { mockXHR } = require('../mock')
// mockXHR()
// }
Vue.use(uploading).use(permission).use(loadmore).use(SvgIcon); // .use(hls)

Vue.use(Element, {
  size: Cookies.get('size') || 'small', // set element-ui default size
  // locale: enLang, // 如果使用中文，无需设置，请删除
});
// system: 'zhangyu';
Vue.use(BiElementUi, {
  dev: import.meta.env.MODE !== 'production',
  env: import.meta.env.MODE,
  system: 'zhangyu',
});
// 全局组件
Vue.component('BiDrawer', BiDrawer);
Vue.config.productionTip = false;
new Vue({
  el: '#app',
  router,
  store,
  render: (h) => h(App),
});

// 处理vue文件中有jsx的文件

// import vue2JSX from 'vite-vue2-script-jsx';
// import { fileURLToPath } from 'url';
// import path from 'path';
// // 拿到当前文件的文件夹
// const absolutePath = fileURLToPath(import.meta.url);
// const basename = path.basename(absolutePath);
// const aimPath = absolutePath.replace(`/${basename}`, '');
// const aimFolder = aimPath + '/example';

// vue2JSX({
//   basePath: aimFolder,
//   includes: ['views', 'components'],
// });
